﻿using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Recomendaciones.Entidades;
using Recomendaciones.AccesoADatos;

/// <summary>
/// Descripción breve de PaisServices
/// </summary>
public class PaisServices
{
    Ado _ado;

    #region Constructor y Destructor
    public PaisServices()
    {
        _ado = new Ado();
    }

    ~PaisServices()
    {
        _ado = null;
    }
    #endregion

    public List<Pais> ObtenerPaises()
    {
        try
        {
            _ado.EjecutarStoredProcedureDataReader("Pais_ObtenerTodos");
            DataTable paises = _ado.DevolverDatosRapido();

            return (List<Pais>)CollectionHelper.ConvertTo<Pais>(paises);
        }
        catch (Exception ex)
        {
            LogErrorServices logErrorService = new LogErrorServices();
            logErrorService.InsertarLogError(ex.GetType().ToString(), ex.StackTrace, ex.Message, ex.GetBaseException().ToString(), ex.Source);
            return null;
        }
    }

}
